package com.damacheng009.future.alarm;

import java.io.IOException;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import com.damacheng009.future.alarm.job.CngoldOneHourJob;
import com.damacheng009.future.alarm.job.FutureDayKLines2DBJob;
import com.damacheng009.future.alarm.job.SinaOneHourJob;
import com.damacheng009.future.alarm.job.StockDayKLines2DBJob;
import com.damacheng009.future.alarm.job.TecentStockOneHourJob;
import com.damacheng009.future.alarm.toolkit.DaoTool;
import com.damacheng009.future.alarm.toolkit.GlobalConfig;

import cn.hutool.core.io.IORuntimeException;
import cn.hutool.cron.CronUtil;

@SpringBootApplication
public class Application {

	public static void main(String[] args) throws InterruptedException, IORuntimeException, IOException {
		// 启动spring boot
		SpringApplication.run(Application.class, args);
		
		// 初始化全局配置
		GlobalConfig.init();
		
		// 初始化数据库相关
		DaoTool.init();
		
		// 初始化定时任务
		CronUtil.start();
		
		// 手动初始化日线数据到数据库
		new FutureDayKLines2DBJob().run();
		//new StockDayKLines2DBJob().run();

		System.out.println("程序启动");
		
		new CngoldOneHourJob().run();
		new SinaOneHourJob().run();
		//new TecentStockOneHourJob().run(); 
	}
	
}
